package action;

import java.util.List;
import model.ProspectusInfo;
import model.User;
import action.base.BaseAction;

import com.opensymphony.xwork2.ActionContext;

public class SelfGetProspectusInfo extends BaseAction {
	private User user;
	private ProspectusInfo prospectusInfo;
	public ProspectusInfo getProspectusInfo() {
		return prospectusInfo;
	}
	public void setProspectusInfo(ProspectusInfo prospectusInfo) {
		this.prospectusInfo = prospectusInfo;
	}
	public String execute() throws Exception{
		ActionContext ctx = ActionContext.getContext();
		user = (User)ctx.getSession().get("USER");
		List<ProspectusInfo> ei = mgpi.getProspectusByUser(user);
		if(ei.size()>0){
			ProspectusInfo e = (ProspectusInfo)ei.get(0);
			setProspectusInfo(e);
			ctx.getSession().put("PI", e);
			return "input";
		}else{
			return "input";
		}
	}
}
